using System;
using System.Collections;
using System.Collections.Generic;

namespace Genko.Model.Collections
{
	public abstract class MemberList : MemberCollection, IList<Member>
	{
		protected internal MemberList()
			: base()
		{

		}

		protected internal MemberList(Member owner)
			: base(owner)
		{

		}

		public abstract bool IsReadOnly
		{
			get;
		}

		public abstract Member this[int index]
		{
			get;
			set;
		}

		public abstract Member this[string memberId]
		{
			get;
		}
		
		public virtual Member FirstMember
		{
			get {
				if (Count > 0) {
					return this[0];
				}
				return null;
			}
		}
		
		public virtual Member LastMember
		{
			get {
				if (Count > 0) {
					return this[Count - 1];
				}
				return null;
			}
		}

		public abstract int IndexOf(Member item);

		public abstract void Insert(int index, Member item);

		public abstract void RemoveAt(int index);

		public abstract void Add(Member item);

		public virtual void Add(IEnumerable<Member> items)
		{
			foreach (Member member in items) {
				this.Add(member);
			}
		}

		public abstract void Clear();

		public abstract bool Contains(Member item);

		public abstract void CopyTo(Member[] array, int arrayIndex);

		public abstract bool Remove(Member item);
	}
}
